package cubelabs.nexus.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import cubelabs.nexus.enums.SessionStatus;
import java.util.Set;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;



@Entity
public class Session extends BaseEntity {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long id;

	private String title;
		
	private String htmlDescription;
	
	private Date startTime;
	
	private Date endTime;
	
	@ManyToOne
	Category category;
	
	
	private int price;
	
	@ManyToOne
	private User expert;
	
	@OneToMany
	private List<Invitation> invitation;
	
	@OneToOne
	private Invitation expertInvitation;
	

	@OneToMany
	private List<Viewer> viewers;
	
	private boolean oneToMany;
	
	private SessionStatus sessionStatus;
	
	private int maxSeats;

	private String opentokToken;
	
        
	@ManyToMany
	@JoinTable(
      name="session_category",
      joinColumns={@JoinColumn(name="session_id", referencedColumnName="id")},
      inverseJoinColumns={@JoinColumn(name="category_id", referencedColumnName="id")})
	private Set<Category> categories;
	

	public Long getId() {
		return id;
	}

    public Set<Category> getCategories() {
        return categories;
    }

    public void setCategories(Set<Category> categories) {
        this.categories = categories;
    }
        
        

	public void setId(Long id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getHtmlDescription() {
		return htmlDescription;
	}

	public void setHtmlDescription(String htmlDescription) {
		this.htmlDescription = htmlDescription;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public User getExpert() {
		return expert;
	}

	public void setExpert(User expert) {
		this.expert = expert;
	}

	public List<Invitation> getInvitation() {
		return invitation;
	}

	public void setInvitation(List<Invitation> invitation) {
		this.invitation = invitation;
	}

	public List<Viewer> getViewers() {
		return viewers;
	}

	public void setViewers(List<Viewer> viewers) {
		this.viewers = viewers;
	}

	public boolean isOneToMany() {
		return oneToMany;
	}

	public void setOneToMany(boolean oneToMany) {
		this.oneToMany = oneToMany;
	}

	public SessionStatus getSessionStatus() {
		return sessionStatus;
	}

	public void setSessionStatus(SessionStatus sessionStatus) {
		this.sessionStatus = sessionStatus;
	}

	public int getMaxSeats() {
		return maxSeats;
	}

	public void setMaxSeats(int maxSeats) {
		this.maxSeats = maxSeats;
	}

	public String getOpentokToken() {
		return opentokToken;
	}

	public void setOpentokToken(String opentokToken) {
		this.opentokToken = opentokToken;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public Invitation getExpertInvitation() {
		return expertInvitation;
	}

	public void setExpertInvitation(Invitation expertInvitation) {
		this.expertInvitation = expertInvitation;
	}

}
